package com.woniu.springboot.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.woniu.springboot.entity.Student;
/**
  * 使用 JpaRepository
 * @author Administrator
 *
 */

public interface StudentDao2 extends JpaRepository<Student, Integer>{
	/**
	 * @param sname
	 * @return
	 */
	public Student findStudentBySname(String sname);
	
	@Query(value = "select * from student where sname=? and age=?",nativeQuery = true)
	public Student selectStudentBySnameAndAge(String sname,Integer age);
	
	public List<Student> findStudentBySnameOrAge(String sname,Integer age);
	
	public List<Student> findStudentBySnameOrAgeAndSid(String sname,Integer age,Integer Sid);
	
	public Integer countByAge(Integer age);
	
	public void deleteBySname(String sname);

}
